import request from '@/config/axios'

// 厂商 VO
export interface FirmVO {
  id: number
  name: string // 名称
  code: string // 编码
  address: string // 地址
  contacts: string // 联系人
  phone: string // 电话
  enable: boolean // 是否启用
}

// 厂商 API
export const FirmApi = {
  // 查询厂商分页
  getFirmPage: async (params: any) => {
    return await request.get({ url: `/forward/firm/page`, params })
  },

  // 查询厂商详情
  getFirm: async (id: number) => {
    return await request.get({ url: `/forward/firm/get?id=` + id })
  },

  // 新增厂商
  createFirm: async (data: FirmVO) => {
    return await request.post({ url: `/forward/firm/create`, data })
  },

  // 修改厂商
  updateFirm: async (data: FirmVO) => {
    return await request.put({ url: `/forward/firm/update`, data })
  },

  // 删除厂商
  deleteFirm: async (id: number) => {
    return await request.delete({ url: `/forward/firm/delete?id=` + id })
  },

  // 查询所有
  getAllFirm: async () => {
    return await request.get({ url: `/forward/firm/getAllFirm` })
  },

  // 导出厂商 Excel
  exportFirm: async (params) => {
    return await request.download({ url: `/forward/firm/export-excel`, params })
  },
}
